package com.qumitech.visualnovel.datasource.channel;

import com.qumitech.visualnovel.model.dao.channel.ChannelData;
import com.qumitech.visualnovel.model.dao.channel.LaunchChannelData;
import com.qumitech.visualnovel.model.dao.channel.LaunchData;
import com.qumitech.visualnovel.model.dao.channel.LaunchExpense;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;

@Mapper
public interface ChannelDataMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table statistics_dcchannelorderstat
     *
     * @mbggenerated
     */

    List<ChannelData> getChannelDataList(@Param("startTime") String startTime,
                                         @Param("endTime") String endTime,
                                         @Param("channel") String channel,
                                         @Param("appId") String appId,
                                         @Param("offset") int offset,
                                         @Param("pageSize") int pageSize,
                                         @Param("orderType")String orderType,
                                         @Param("orderBy")String orderBy,
                                         @Param("channelType") Integer channelType);

    List<HashMap<String,Object>> getChannelOptions();

    int ChannelDataListCount(@Param("startTime") String startTime,
                                    @Param("endTime") String endTime,
                                    @Param("channel") String channel,
                                    @Param("appId") String appId,
                                    @Param("channelType") Integer channelType);

    int deleteByPrimaryKey(Integer id);

    int insert(ChannelData record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table statistics_dcchannelorderstat
     *
     * @mbggenerated
     */
    int insertSelective(ChannelData record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table statistics_dcchannelorderstat
     *
     * @mbggenerated
     */
    ChannelData selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table statistics_dcchannelorderstat
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(ChannelData record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table statistics_dcchannelorderstat
     *
     * @mbggenerated
     */
    int updateByPrimaryKey(ChannelData record);

    HashMap<String, Object> getTotalValue(@Param("startTime") String startTime, @Param("endTime") String endTime,
                                          @Param("channel") String channel, @Param("appId") String appId,
                                          @Param("channelType") Integer channelType);

    List<LaunchData> getLaunchDataList(@Param("startTime") String startTime,
                                        @Param("endTime") String endTime,
                                        @Param("channel") String channel,
                                        @Param("appId") String appId,
                                        @Param("offset") int offset,
                                        @Param("pageSize") int pageSize,
                                        @Param("orderType") String orderType,
                                        @Param("orderBy") String orderBy,
                                        @Param("channelType") Integer channelType,
                                       @Param("tableName") String tableName);

    List<LaunchData> getLaunchDataListSum(@Param("startTime") String startTime,
                                       @Param("endTime") String endTime,
                                       @Param("channel") String channel,
                                       @Param("appId") String appId,
                                       @Param("channelType") Integer channelType,
                                       @Param("tableName") String tableName);


    List<LaunchData> getLaunchDataListTotal(@Param("startTime") String startTime,
                                       @Param("endTime") String endTime,
                                       @Param("channelReg") String channelReg,
                                       @Param("appId") String appId,
                                       @Param("offset") int offset,
                                       @Param("pageSize") int pageSize,
                                       @Param("orderType") String orderType,
                                       @Param("orderBy") String orderBy,
                                       @Param("channelType") Integer channelType,
                                       @Param("tableName") String tableName,
                                       @Param("statistics") int statistics);

    int LaunchDataListCount(@Param("startTime") String startTime,
                             @Param("endTime") String endTime,
                             @Param("channel") String channel,
                             @Param("appId") String appId,
                             @Param("channelType") Integer channelType,
                            @Param("tableName") String tableName);

    List<LaunchExpense> getLaunchExpenseList(@Param("startTime") String startTime,
                                             @Param("endTime") String endTime,
                                             @Param("channel") String channel,
                                             @Param("offset") int offset,
                                             @Param("pageSize") int pageSize,
                                             @Param("orderBy") String orderBy,
                                             @Param("orderType") String orderType
                                             );

    int getLaunchExpenseListCount(@Param("startTime") String startTime,
                               @Param("endTime") String endTime,
                               @Param("channel") String channel);

    void updateLaunchExpense( @Param("targetDate") String targetDate,
                              @Param("channel") String channel,
                              @Param("expense") Float expense,
                              @Param("downloadCount") Long downloadCount,
                              @Param("tableName") String tableName);

    void updateLaunchTotalExpense(@Param("targetDate") String targetDate,
                                  @Param("tableName") String tableName);


    List<String> getActiveChannel(@Param("targetDate") String targetDate);
}